﻿using HECore.Common.Entitys;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Internal;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace HECore.Tenant.Repository.Entites
{
    /// <summary>
    /// 员工Token
    /// </summary>
    public class EmployeeToken : EmployeeDeletionAudited
    {
        /// <summary>
        /// 主键
        /// </summary>
        [Key]
        public Guid Id { get; set; }

        /// <summary>
        /// IP地址
        /// </summary>
        [Comment("IP地址")]
        [StringLength(128)]
        [Column(Order = 0)]
        public string IP { get; set; }

        /// <summary>
        /// 令牌
        /// </summary>
        [Comment("令牌")]
        [Column(Order = 1)]
        public Guid Token { get; set; }

        /// <summary>
        /// 令牌过期时间
        /// </summary>
        [Column(TypeName = "datetime", Order = 2)]
        [Comment("令牌过期时间")]
        public DateTime TokenExpireTime { get; set; }

        /// <summary>
        /// 刷新令牌
        /// </summary>
        [Comment("刷新令牌")]
        [Column(Order = 3)]
        public Guid RefreshToken { get; set; }

        /// <summary>
        /// 刷新令牌过期时间
        /// </summary>
        [Column(TypeName = "datetime", Order = 4)]
        [Comment("刷新令牌过期时间")]
        public DateTime RefreshTokenExpireTime { get; set; }

        /// <summary>
        /// 刷新Token计数
        /// </summary>
        [Column(Order = 5)]
        [Comment("刷新Token计数")]
        public int RefreshCount { get; set; } = 0;
    }
}
